<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use App\Models\Points;
class CreatePointsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create( Points::TABLE, function (Blueprint $table) {
            $table->integer('user_id')->unsigned();//所属ID
            $table->decimal('asset', 15, 6)->default(0);//资产
            $table->decimal('frozen_asset', 15, 6)->default(0);//冻结资产
            $table->decimal('expense_asset', 15, 6)->default(0);//消费资产
            $table->integer('integer')->default(0);//积分
            $table->integer('point_bao')->default(0);//积分宝
            $table->json('other_points')->nullable(); //自定义积分
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists( Points::TABLE);
    }
